div.container
  h1 Settings
  h2 Webcam
  p The plugin requires&nbsp;
    code streamer
    | &nbsp;or&nbsp;
    code motion 
    | &nbsp;to capture images from your webcam. To install it, run one of the following command on your Raspberry PI console:
  pre sudo apt-get install streamer
  pre sudo apt-get install motion
  p
    code motion
    | &nbsp;needs to be configured and running as a daemon.  
  - if (typeof(success) !== 'undefined')
    div.alert.alert-success.fade.in
      button.close(type="button", data-dismiss="alert") ×
      =success
  div.row16
    form(action="/settings/webcam", method="post")
      div#webcam
        each item, i in items
          div.plugin-container.webcam(id="#{item._id}")
            button.btn.btn-danger.pull-right.delete(type="button",data-delete="#{item._id}")
              i.icon-trash.icon-large
              |  Delete

            div.switch
              label(for="method") Method:
              select(name="data[#{i}][method]")
                option(disabled="disabled",selected=(item.method == '')) Choose Method
                option(value="streamer",selected=(item.method == 'streamer')) streamer
                option(value="motion",selected=(item.method == 'motion')) motion
              div.switch-container
                div.streamer(class=(item.method != 'streamer' ? 'hidden' : ''))
                  label(for="input") Input Device:
                  select(name="data[#{i}][input]")
                    each input in meta.devices
                      option(value="#{input}",selected=(item.input == input)) #{input}

                  label(for="interval") Interval in seconds:
                  input(type="text", name="data[#{i}][interval]", placeholder="10", required="1", value="#{item.interval}", pattern="^[0-9]*$")
                  input(type="hidden", name="data[#{i}][_id]", value="#{item._id}")
                div.motion(class=(item.method != 'motion' ? 'hidden' : ''))
                  label(for="port") Stream Port:
                  input(type="text", name="data[#{i}][port]", placeholder="8082", required="1", value="#{item.port}")
          
      p.webcam.buttons
        button.btn.btn-info.add(data-target="webcam", type="button", data-callback="registerSelectSwitch()") 
          i.icon-plus.icon-large
          |  Add
      
        button.btn.btn-success.save(type="submit") 
          i.icon-save.icon-large
          |  Save
      
input(type="hidden", name="iterator", id="iterator", value=(items.length))
      
div.plugin-container.webcam.settings#template(style="display: none;")
  button.btn.btn-danger.pull-right.delete(type="button")
    i.icon-trash.icon-large
    |  Delete  

  div.switch
    label(for="method") Method:
    select(name="data[%i%][method]")
      option(disabled="disabled",selected="true") Choose Method
      option(value="streamer") streamer
      option(value="motion") motion
    div.switch-container
      div.streamer.hidden
        label(for="input") Input Device:
        select(name="data[%i%][input]")
          each input in meta.devices
            option(value="#{input}") #{input}
        label(for="interval") Interval in seconds:
        input(type="text", name="data[%i%][interval]", placeholder="10", required="1", pattern="^[0-9]*$")
    
      div.motion.hidden
        label(for="url") Stream Port:
        input(type="text", name="data[%i%][port]", placeholder="8082", required="1")
